﻿using Admin.IoC;
using Microsoft.Practices.Unity;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using YTCMS.Data.Infrastructure;
using YTCMS.Data.Repositories;
using YTCMS.Services.Services;

namespace Admin.Unity
{
    public class YTUnityContainer
    {
        public static IUnityContainer GetUnityContainer()
        {
            IUnityContainer container = new UnityContainer()
            .RegisterType<IControllerActivator, CustomControllerActivator>()
            .RegisterType<IDatabaseFactory, DatabaseFactory>(new HttpContextLifetimeManager<IDatabaseFactory>())
            .RegisterType<IUnitOfWork, UnitOfWork>(new HttpContextLifetimeManager<IUnitOfWork>())
            .RegisterType<IadsRepository, adsRepository>(new HttpContextLifetimeManager<IadsRepository>())
            .RegisterType<IadsService, adsService>(new HttpContextLifetimeManager<IadsService>())



            .RegisterType<IcategoryRepository, categoryRepository>(new HttpContextLifetimeManager<IcategoryRepository>())
            .RegisterType<IcategoryService, categoryService>(new HttpContextLifetimeManager<IcategoryService>())

            .RegisterType<IcmscolumnRepository, cmscolumnRepository>(new HttpContextLifetimeManager<IcmscolumnRepository>())
            .RegisterType<IcmscolumnService, cmscolumnService>(new HttpContextLifetimeManager<IcmscolumnService>())

            .RegisterType<IcontentRepository, contentRepository>(new HttpContextLifetimeManager<IcontentRepository>())
            .RegisterType<IcontentService, contentService>(new HttpContextLifetimeManager<IcontentService>())

            .RegisterType<IcorrelationkeywordRepository, correlationkeywordRepository>(new HttpContextLifetimeManager<IcorrelationkeywordRepository>())
            .RegisterType<IcorrelationkeywordService, correlationkeywordService>(new HttpContextLifetimeManager<IcorrelationkeywordService>())

            .RegisterType<IkeywordRepository, keywordRepository>(new HttpContextLifetimeManager<IkeywordRepository>())
            .RegisterType<IkeywordService, keywordService>(new HttpContextLifetimeManager<IkeywordService>())

            .RegisterType<ImoduleRepository, moduleRepository>(new HttpContextLifetimeManager<ImoduleRepository>())
            .RegisterType<ImoduleService, moduleService>(new HttpContextLifetimeManager<ImoduleService>())



            .RegisterType<IproductsRepository, productsRepository>(new HttpContextLifetimeManager<IproductsRepository>())
            .RegisterType<IproductsService, productsService>(new HttpContextLifetimeManager<IproductsService>())

            .RegisterType<ItestRepository, testRepository>(new HttpContextLifetimeManager<ItestRepository>())
            .RegisterType<ItestService, testService>(new HttpContextLifetimeManager<ItestService>())

            .RegisterType<IusersRepository, usersRepository>(new HttpContextLifetimeManager<IusersRepository>())
            .RegisterType<IusersService, usersService>(new HttpContextLifetimeManager<IusersService>())

            .RegisterType<IcolumnproductRepository, columnproductRepository>(new HttpContextLifetimeManager<IcolumnproductRepository>())
            .RegisterType<IcolumnproductService, columnproductService>(new HttpContextLifetimeManager<IcolumnproductService>())

            .RegisterType<IcustomRepository, customRepository>(new HttpContextLifetimeManager<IcustomRepository>())
            .RegisterType<IcustomService, customService>(new HttpContextLifetimeManager<IcustomService>())

            .RegisterType<IhotelRepository, hotelRepository>(new HttpContextLifetimeManager<IhotelRepository>())
            .RegisterType<IhotelService, hotelService>(new HttpContextLifetimeManager<IhotelService>())
            .RegisterType<IimagesRepository, imagesRepository>(new HttpContextLifetimeManager<IimagesRepository>())
            .RegisterType<IimagesService, imagesService>(new HttpContextLifetimeManager<IimagesService>())

            .RegisterType<IguideRepository, guideRepository>(new HttpContextLifetimeManager<IguideRepository>())
            .RegisterType<IguideService, guideService>(new HttpContextLifetimeManager<IguideService>())
            ;
            return container;

        }
    }
}